<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*,java.util.Vector" errorPage="" %>
<jsp:useBean id="filedealer"  class="basetools.FileDealer"/>
<jsp:useBean id="examxml"  class="xml.examxml"/>
<jsp:useBean id="bf"  class="basetools.BaseFunction"/>
<jsp:useBean id="base64"  class="basetools.Base64"/>
<jsp:useBean id="sqltool"  class="basetools.SqlTool"/>
<%@ page import="java.util.Vector"%>
<%@ page import="java.io.File"%>
<%@ page import="java.io.*"%>
<%@ page import="org.jdom.*"%>
<%@ page import="org.jdom.output.*"%>
<%!int num,i,itemcount,themecount=0,j;String  answer,answertype="1",examkey="",currentuser="ytm",examcheckcode="0",examuserkey="",notjudge="";%>
<%

   try{
      String username="",enterprice="",departname="",parentdepart="",oldname="";

      if(session.getAttribute("username")!=null){
         username=(String)session.getAttribute("username");
      }
      if(session.getAttribute("enterprice")!=null){
         enterprice=(String)session.getAttribute("enterprice");
      }
      if(request.getParameter("notjudge")!=null){
         notjudge=new String(request.getParameter("notjudge").getBytes("iso-8859-1"),"gbk");
      }
      String ipaddress=request.getRemoteAddr();
      response.setContentType("text/html; charset=gbk");
      String userstate=null;


      if(!notjudge.equals("1")){

         userstate=servlet.AttributeListener.judgeuser(enterprice,username,ipaddress,"1",request);
         if(userstate.equals("1"))notjudge="1";
      }
      if(notjudge.equals("1")){
         String execsql="",key="",ifcode="0",split1="|",split2="@",formhandin="";
         formhandin="";
         if(request.getParameter("formhandin")!=null){
            formhandin=new String(request.getParameter("formhandin").getBytes("iso-8859-1"),"gbk");
         }

         if(request.getParameter("execsql")!=null){
            execsql=new String(request.getParameter("execsql").getBytes("iso-8859-1"),"gbk");
         }
         if(request.getParameter("key")!=null){
            key=new String(request.getParameter("key").getBytes("iso-8859-1"),"gbk");
         }
         if(request.getParameter("ifcode")!=null){
            ifcode=new String(request.getParameter("ifcode").getBytes("iso-8859-1"),"gbk");
         }
         if(request.getParameter("split1")!=null){
            split1=new String(request.getParameter("split1").getBytes("iso-8859-1"),"gbk");
         }
         if(request.getParameter("split2")!=null){
            split2=new String(request.getParameter("split2").getBytes("iso-8859-1"),"gbk");
         }

         execsql=base64.deescape(execsql);

         //key=base64.deescape(key);
         System.out.println(key);

         String keylist=sqltool.getfieldlist(key,execsql,ifcode,split1,split2);
         if(formhandin.equals("1")){
            out.print("<script>try{parent.finishdo('"+keylist+"')}catch(ex){}</script>");
         }else{
            response.getWriter().println(keylist);
         }
      }else{
         out.print("<script>try{parent.finishdo('')}catch(ex){}</script>");
         response.getWriter().println("");
      }
   }catch(Exception e){
      System.out.println(e.getMessage());
   }
%>